package com.mvd.app.activity;

import android.app.DatePickerDialog;
import android.app.Dialog;
import android.content.Intent;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.support.design.widget.FloatingActionButton;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.TextView;
import android.widget.Toast;

import com.google.gson.Gson;
import com.kongzue.dialog.v3.WaitDialog;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response;
import com.lzy.okgo.request.base.Request;
import com.mvd.app.R;
import com.mvd.app.ac2021.CarActivity;
import com.mvd.app.adapter.CarsInforListAdapter;
import com.mvd.app.adapter.MyAccountModeListAdapter;
import com.mvd.app.application.BaseApplication;
import com.mvd.app.commons.CommonUtils;
import com.mvd.app.commons.Constants;
import com.mvd.app.commons.DateUtil;
import com.mvd.app.commons.FileUtils;
import com.mvd.app.commons.JsonUtil;
import com.mvd.app.commons.PDALogUtils;
import com.mvd.app.commons.SharedPreferencesUtils;
import com.mvd.app.commons.UtilsLog;
import com.mvd.app.model.CarCheckItemsModel;
import com.mvd.app.model.CarsInforModel;
import com.mvd.app.model.CarsInforModel_RiZhao;
import com.mvd.app.model.DownLineModel;
import com.mvd.app.upload.MyUploadVideoActivity;

import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * @Description: 待检车辆列表
 */
public class DaiJianCars2Activity extends BaseActivity implements AdapterView.OnItemClickListener {

    @BindView(R.id.title_btn_left)
    ImageButton titleBtnLeft;
    @BindView(R.id.title_btn_left_txt)
    Button titleBtnLeftTxt;
    @BindView(R.id.title_txt)
    TextView titleTxt;
    @BindView(R.id.iv_headtip)
    ImageView ivHeadtip;
    @BindView(R.id.title_btn_right_txt)
    Button titleBtnRightTxt;
    @BindView(R.id.title_btn_right)
    ImageButton titleBtnRight;
    @BindView(R.id.ac_daijian_et_search2)
    EditText acDaijianEtSearch2;
    @BindView(R.id.ac_daijian_btn_search2)
    Button acDaijianBtnSearch2;
    @BindView(R.id.ac_daijian_bt_type2)
    Button acDaijianBtType2;
    @BindView(R.id.list_shequgonggao_baoxiu)
    ListView listShequgonggaoBaoxiu;
    @BindView(R.id.fab)
    FloatingActionButton fab;
    @BindView(R.id.ac_daijian_btn_chongxin_xiaxian)
    Button acDaijianBtnChongxinXiaxian;
    @BindView(R.id.ac_set_view_m_2_image)
    TextView acSetViewM2Image;
    @BindView(R.id.ac_daijian_btn_buchuan_zhaopian)
    Button acDaijianBtnBuchuanZhaopian;
    @BindView(R.id.ac_daijian_lay_ll_statement)
    LinearLayout acDaijianLayStatament;
    @BindView(R.id.ac_daijian_start_time)
    TextView acDaijianStartTime;
    @BindView(R.id.ac_daijian_end_time)
    TextView acDaijianEndTime;
    @BindView(R.id.ac_daijian_layout_query)
    LinearLayout acDaijianLayoutQuery;

    private int CHECK_MODE = 0;//检测模式 0:外检  1：路试 2：底盘动态
    private List<CarsInforModel> carsInforModelList = new ArrayList<CarsInforModel>();
    private List<CarsInforModel> carsInforModelList_2 = new ArrayList<CarsInforModel>();
    private List<CarsInforModel> searChCarsList_one = new ArrayList<CarsInforModel>();//查询的列表
    private List<CarsInforModel> searChCarsList_two = new ArrayList<CarsInforModel>();//查询的列表
    private List<CarsInforModel> searChCarsFilterList = new ArrayList<CarsInforModel>();//查询后过滤的列表

    //adapter的过滤后的数据列表
    private List<CarsInforModel> adapterCarsList = new ArrayList<CarsInforModel>();
    private CarsInforListAdapter carsInforListAdapter;
    public DaiJianCars2Activity instances = null;
    private String carNO = null;
    private List<CarCheckItemsModel> carCheckItemModelList = new ArrayList<CarCheckItemsModel>();
    //待检测车辆要检测的项目的列表
    private String CURRENT_CHECK_MODE = "";//当前检测模式
    private String Login_name = "", login_IDNumber;//当前登录的检测员的名字
    private DownLineModel downLineModel;
    private Handler handler = new Handler();
    MyRunnable myRunnable = new MyRunnable();//定义MyRunnable的对象；
    //日照的
    private List<CarsInforModel_RiZhao> riZhao_carsInforModelList = new ArrayList<CarsInforModel_RiZhao>();
    private String StartTime = null;
    private String EndTime = null;
    final Calendar ca = Calendar.getInstance();
    int mYear, mMonth, mDay;
    final int DATE_DIALOG = 1;
    final int DATE_DIALOG2 = 2;
    private boolean isQuery = false;
    private boolean isButton = false;//是否点击查询按钮

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dai_jian_cars_2);
        ButterKnife.bind(this);
        setTopTitle(R.string.activity_daijian_car_list);
        setHideLeftBtn();
        instances = this;
        isQuery = SharedPreferencesUtils.getQueryQueue(instances);
        if (isQuery) {
            acDaijianLayoutQuery.setVisibility(View.VISIBLE);
        } else {
            acDaijianLayoutQuery.setVisibility(View.GONE);
        }

        mYear = ca.get(Calendar.YEAR);
        mMonth = ca.get(Calendar.MONTH);
        mDay = ca.get(Calendar.DAY_OF_MONTH);

        acDaijianStartTime.setText(DateUtil.getLastWeekDate());
        acDaijianEndTime.setText(DateUtil.getTodayDate2());
        Login_name = getIntent().getExtras().getString("login_UserID", "");
        login_IDNumber = getIntent().getExtras().getString("login_IDNumber", "");

        CHECK_MODE = BaseApplication.JIANCE_MODE;
        UtilsLog.e(" BaseApplication.JIANCE_MODE-DaiJianCars2Activity==" + BaseApplication.JIANCE_MODE);
        listShequgonggaoBaoxiu.setOnItemClickListener(this);
        pop_type();

        //重新下线  补传照片 两个按钮全部隐藏
        acDaijianLayStatament.setVisibility(View.GONE);

        switch (BaseApplication.JIANCE_MODE) {
            //检测模式 0:外检  F1 1：路试 R1 2：底盘动态 DC
            case 0:
                CURRENT_CHECK_MODE = "F1";
//                if (SharedPreferencesUtils.getBuChuanZhaoPianStatement(instances)) {
////                    acDaijianBtnBuchuanZhaopian.setVisibility(View.VISIBLE);
//                    setRightTxt("补传照片", new View.OnClickListener() {
//                        @Override
//                        public void onClick(View v) {
//                            Intent i = new Intent(DaiJianCars2Activity.this, RecheckPhotoListActivity.class);
//                            startActivity(i);
//                        }
//                    });
//                } else {
////                    acDaijianBtnBuchuanZhaopian.setVisibility(View.GONE);
//                }


                //重新下线与补传照片的开关显示与隐藏---默认隐藏
                if (SharedPreferencesUtils.getChongXinXiaXianStatement(instances) == false &&
                        SharedPreferencesUtils.getBuChuanZhaoPianStatement(instances) == false) {
                    acDaijianLayStatament.setVisibility(View.GONE);
                } else {
                    acDaijianLayStatament.setVisibility(View.VISIBLE);
                }
//        Log.e("tag", "重新下线设置==" + SharedPreferencesUtils.getChongXinXiaXianStatement(instances));
//        Log.e("tag", "补传照片设置==" + SharedPreferencesUtils.getBuChuanZhaoPianStatement(instances));
                if (SharedPreferencesUtils.getChongXinXiaXianStatement(instances)) {
                    acDaijianBtnChongxinXiaxian.setVisibility(View.VISIBLE);
                } else {
                    acDaijianBtnChongxinXiaxian.setVisibility(View.GONE);
                }

                if (SharedPreferencesUtils.getBuChuanZhaoPianStatement(instances)) {
                    acDaijianBtnBuchuanZhaopian.setVisibility(View.VISIBLE);
                } else {
                    acDaijianBtnBuchuanZhaopian.setVisibility(View.GONE);
                }
                break;
            case 1:
                CURRENT_CHECK_MODE = "R1";
                break;
            case 2:
                CURRENT_CHECK_MODE = "DC";
                break;
        }
        try {
            String filePath = null;
            filePath = Environment.getExternalStorageDirectory() + "/PDASetting/setting.txt";
            String reCheckPhotoSetting = FileUtils.readTextFile(new File(filePath)).trim();
            Log.e("tag", "复检拍照设置==" + reCheckPhotoSetting);
//            if (!TextUtils.isEmpty(reCheckPhotoSetting)) {
//                if (reCheckPhotoSetting.equals("123456")) {
//                    acDaijianBtType2.setVisibility(View.GONE);
//                    Log.e("tag", "复检拍照设置=======隐藏=");
//                } else {
//                    Log.e("tag", "复检拍照设置====11===显示=");
//                    acDaijianBtType2.setVisibility(View.VISIBLE);
//                }
//            } else {
//                Log.e("tag", "复检拍照设置====22===显示=");
//                acDaijianBtType2.setVisibility(View.VISIBLE);
//            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        setRightTxt("录像列表", new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent(DaiJianCars2Activity.this, MyUploadVideoActivity.class);
                startActivity(i);
            }
        });
    }

    @OnClick({R.id.ac_daijian_btn_search2, R.id.ac_daijian_bt_type2, R.id.fab,
            R.id.ac_daijian_btn_chongxin_xiaxian, R.id.ac_daijian_btn_buchuan_zhaopian,
            R.id.ac_daijian_start_time, R.id.ac_daijian_end_time
    })
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.ac_daijian_btn_search2:
                //查询
                carNO = acDaijianEtSearch2.getText().toString().trim();
                StartTime = acDaijianStartTime.getText().toString().trim();
                EndTime = acDaijianEndTime.getText().toString().trim();
                isButton = true;
                if (!TextUtils.isEmpty(carNO)) {
                    CommonUtils.showLoadingDialog(instances, "加载中...");
                    downLineModel = new DownLineModel();
                    downLineModel.setType("0");
                    downLineModel.setPlateNO(carNO);
                    downLineModel.setStartDate(StartTime);
                    downLineModel.setEndDate(EndTime);
                    searChCarsFilterList = new ArrayList<CarsInforModel>();//查询后过滤的列表
                    for (int i = 0; i < 2; i++) {
                        if (i == 0) {
                            downLineModel.setStatus("0");
                            getDataSearchCarsByNO(downLineModel);
//                            Handler handler = new Handler();
//                            handler.postDelayed(new Runnable() {
//                                @Override
//                                public void run() {
//                                    getDataSearchCarsByNO(downLineModel);
//                                }
//                            }, 1000);//后执行Runnable中的run方法

                        } else if (i == 1) {
                            downLineModel.setStatus("1");
                            getDataSearchCarsByNO(downLineModel);
//                            Handler handler = new Handler();
//                            handler.postDelayed(new Runnable() {
//                                @Override
//                                public void run() {
//                                    getDataSearchCarsByNO(downLineModel);
//                                }
//                            }, 1000);//后执行Runnable中的run方法
                        }
                    }
                } else {
                    Toast.makeText(instances, "车牌号码不能为空", Toast
                            .LENGTH_LONG).show();
                }

//                if (adapterCarsList != null && adapterCarsList.size() > 0) {
//                    searChCarsList = new ArrayList<CarsInforModel>();
//                    for (int i = 0; i < adapterCarsList.size(); i++) {
//                        String cno = (adapterCarsList.get(i).getPlateRegion() + adapterCarsList.get
//                                (i).getPlateNO()).toLowerCase();
//                        if (cno.contains(carNO.toLowerCase())) {
//                            searChCarsList.add(adapterCarsList.get(i));
//                        }
//                    }
//                    carsInforListAdapter = new CarsInforListAdapter(DaiJianCars2Activity.this,
//                            searChCarsList, CURRENT_CHECK_MODE);
//                    listShequgonggaoBaoxiu.setAdapter(carsInforListAdapter);
//                }
                break;
            case R.id.ac_daijian_bt_type2:
//                pop2.showAsDropDown(acDaijianBtType2);
//                //跳转复检拍照界面
//                Intent intent = new Intent(this, RecheckPhotoListActivity.class);
//                startActivity(intent);
                break;
            case R.id.fab:
                if (SharedPreferencesUtils.getAutoRefresh(this)) {
                    getData(0);
                } else {
                    carNO = acDaijianEtSearch2.getText().toString().trim();
                    StartTime = acDaijianStartTime.getText().toString().trim();
                    EndTime = acDaijianEndTime.getText().toString().trim();
                    if (!TextUtils.isEmpty(carNO)) {
                        CommonUtils.showLoadingDialog(instances, "加载中...");
                        downLineModel = new DownLineModel();
                        downLineModel.setType("0");
                        downLineModel.setPlateNO(carNO);
                        downLineModel.setStartDate(StartTime);
                        downLineModel.setEndDate(EndTime);
                        searChCarsFilterList = new ArrayList<CarsInforModel>();//查询后过滤的列表
                        for (int i = 0; i < 2; i++) {
                            if (i == 0) {
                                downLineModel.setStatus("0");
                                getDataSearchCarsByNO(downLineModel);
                            } else if (i == 1) {
                                downLineModel.setStatus("1");
                                getDataSearchCarsByNO(downLineModel);
                            }
                        }
                    } else {
                        Toast.makeText(instances, "车牌号码不能为空", Toast
                                .LENGTH_LONG).show();
                    }
                }
                break;
            case R.id.ac_daijian_btn_chongxin_xiaxian:
                //重新下线
                Intent i = new Intent(DaiJianCars2Activity.this, DownLineCarsListActivity.class);
                startActivity(i);
                break;
            case R.id.ac_daijian_btn_buchuan_zhaopian:
                //跳转复检拍照界面,补传照片
                Intent intent = new Intent(this, RecheckPhotoListActivity.class);
                intent.putExtra("Login_name", Login_name);
                intent.putExtra("login_IDNumber", login_IDNumber);
                startActivity(intent);
                break;
            case R.id.ac_daijian_start_time:
                //开始时间
                showDialog(DATE_DIALOG);
                break;
            case R.id.ac_daijian_end_time:
                //结束时间
                showDialog(DATE_DIALOG2);
                break;
        }
    }

    @Override
    protected Dialog onCreateDialog(int id) {
        switch (id) {
            case DATE_DIALOG:
                return new DatePickerDialog(this, mdateListener, mYear, mMonth, mDay);
            case DATE_DIALOG2:
                return new DatePickerDialog(this, mdateListener2, mYear, mMonth, mDay);
        }
        return null;
    }

    /**
     * 设置日期 利用StringBuffer追加
     */
    public void display(TextView tv) {
        tv.setText(new StringBuffer().append(mYear).append("-").append(mMonth + 1).append("-").append(mDay)
                .append(" "));
    }

    private DatePickerDialog.OnDateSetListener mdateListener = new DatePickerDialog.OnDateSetListener() {

        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear,
                              int dayOfMonth) {
            mYear = year;
            mMonth = monthOfYear;
            mDay = dayOfMonth;
            display(acDaijianStartTime);
        }
    };
    private DatePickerDialog.OnDateSetListener mdateListener2 = new DatePickerDialog.OnDateSetListener() {

        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear,
                              int dayOfMonth) {
            mYear = year;
            mMonth = monthOfYear;
            mDay = dayOfMonth;
            display(acDaijianEndTime);
        }
    };

    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//        Intent intent = new Intent(DaiJianCars2Activity.this, CarDetailsActivity.class);
//        startActivity(intent);
        CarsInforModel carsInforModel = (CarsInforModel) parent.getAdapter().getItem(position);
        UtilsLog.e("carsInforModel=33=" + carsInforModel.toString());
        String logStr = "\n" + "外检--车辆列表点击事件----" +
                "\n" + "carsInforModel::" + carsInforModel.toString() + "\n" + "login_IDNumber::" + login_IDNumber + "\n" + "Login_name::" + Login_name +
                "\n" + "CHECK_MODE::" + CHECK_MODE;
        PDALogUtils.createLogFile(BaseApplication.JIANCE_MODE, logStr.getBytes());
        Intent intent2 = null;
        //检测模式 0:外检  1：路试 2：底盘动态
        if (CHECK_MODE == 0) {
            //外检
//            intent2 = new Intent(DaiJianCars2Activity.this, VehicleDetailsActivity.class);
            intent2 = new Intent(DaiJianCars2Activity.this, CarActivity.class);
//            intent2.putExtra("check_mode",BaseApplication.JIANCE_MODE);
        } else if (CHECK_MODE == 1) {
            //路试
            intent2 = new Intent(DaiJianCars2Activity.this, RoadTestActivity.class);
//            intent2.putExtra("check_mode",BaseApplication.JIANCE_MODE);
        } else {
            //底盘动态
            intent2 = new Intent(DaiJianCars2Activity.this, DiPanDongTaiActivity.class);
//            intent2 = new Intent(DaiJianCars2Activity.this, VehicleDetailsActivity.class);
//            intent2.putExtra("check_mode",BaseApplication.JIANCE_MODE);
        }
        intent2.putExtra("model_CarsInforModel", carsInforModel);
        intent2.putExtra("check_mode", CHECK_MODE);
        intent2.putExtra("Login_name", Login_name);
        intent2.putExtra("login_IDNumber", login_IDNumber);
        startActivity(intent2);
    }


    private View view2;
    private LinearLayout parent22;
    private PopupWindow pop2 = null;
    private ListView listview_modes;
    private List<String> typeList = new ArrayList<String>();
    MyAccountModeListAdapter myTypeAdapter;

    private void pop_type() {
        for (int i = 0; i < Constants.JIANCE_TYPE.length; i++) {
            typeList.add(i, Constants.JIANCE_TYPE[i]);
        }
        pop2 = new PopupWindow(this);
        view2 = getLayoutInflater().inflate(R.layout.item_pop_type,
                null);
        pop2.setWidth(LinearLayout.LayoutParams.WRAP_CONTENT);
        pop2.setHeight(LinearLayout.LayoutParams.WRAP_CONTENT);
        pop2.setBackgroundDrawable(new BitmapDrawable());
        pop2.setFocusable(true);
        pop2.setOutsideTouchable(true);
        pop2.setContentView(view2);
        parent22 = (LinearLayout) view2.findViewById(R.id.ac_daijian_car2_parent);
        listview_modes = (ListView) view2.findViewById(R.id.ac_daijian_car2_listview);
        if (typeList != null && typeList.size() > 0) {
            myTypeAdapter = new MyAccountModeListAdapter(DaiJianCars2Activity.this, typeList);
            listview_modes.setAdapter(myTypeAdapter);
            listview_modes.setOnItemClickListener(new AdapterView.OnItemClickListener() {

                @Override
                public void onItemClick(AdapterView<?> arg0, View arg1,
                                        int position, long arg3) {
//                Toast.makeText(LoginActivity.this, "====" + strModes.get(position),
//                        Toast.LENGTH_SHORT).show();
                    acDaijianBtType2.setText(typeList.get(position));
                    pop2.dismiss();
                }
            });
        }
        parent22.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                pop2.dismiss();
            }
        });
    }

    private void getData(int type) {
        if (!TextUtils.isEmpty(SharedPreferencesUtils.getIP(this))) {
            if (CommonUtils.isOnline(this)) {
                if (type == 0) {
                    getDataCarsListByMode();
                } else if (type == 1) {

                }
            } else {
                Toast.makeText(this, getResources().getString(R.string.network_error), Toast.LENGTH_LONG)
                        .show();
            }
        } else {
            Toast.makeText(this, "请设置IP与端口号", Toast.LENGTH_LONG).show();
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
//        acDaijianEtSearch2.setText("");
        UtilsLog.e("是否自动刷新==" + SharedPreferencesUtils.getAutoRefresh(this));
        if (SharedPreferencesUtils.getAutoRefresh(this)) {
            new Thread() {

                @Override
                public void run() {
                    handler.postDelayed(myRunnable, 600);
//                    handler.post(myRunnable);//调用Handler.post方法；
                }
            }.start();
        } else {
            carNO = acDaijianEtSearch2.getText().toString().trim();
            StartTime = acDaijianStartTime.getText().toString().trim();
            EndTime = acDaijianEndTime.getText().toString().trim();
            if (!TextUtils.isEmpty(carNO)) {
                CommonUtils.showLoadingDialog(instances, "加载中...");
                downLineModel = new DownLineModel();
                downLineModel.setType("0");
                downLineModel.setPlateNO(carNO);
                downLineModel.setStartDate(StartTime);
                downLineModel.setEndDate(EndTime);
                searChCarsFilterList = new ArrayList<CarsInforModel>();//查询后过滤的列表
                for (int i = 0; i < 2; i++) {
                    if (i == 0) {
                        downLineModel.setStatus("0");
                        getDataSearchCarsByNO(downLineModel);
                    } else if (i == 1) {
                        downLineModel.setStatus("1");
                        getDataSearchCarsByNO(downLineModel);
                    }
                }
            }
        }
    }


    class MyRunnable implements Runnable {//内部类实现Runnable接口；

        @Override
        public void run() {//还是在Runnable重写的run()方法中更新界面；
            getData(0);
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        OkGo.getInstance().cancelTag(this);
        instances = null;
    }

    //获取车辆列表
    private void getDataCarsList() {
        if (adapterCarsList != null) {
            adapterCarsList.clear();
        }
        UtilsLog.e("getDataCarsList---url==" + SharedPreferencesUtils.getIP(this) + CARS_LIST_DAI_JIAN);
        OkGo.<String>get(SharedPreferencesUtils.getIP(this) + CARS_LIST_DAI_JIAN).tag(this)
                .execute(new StringCallback() {
                    @Override
                    public void onStart(Request<String, ? extends Request> request) {
                        super.onStart(request);
                        CommonUtils.showLoadingDialog(instances, "加载中...");
                    }

                    @Override
                    public void onSuccess(Response<String> response) {
                        String result = response.body();
//                        UtilsLog.e("getDataCarsList-result==" + result);
                        String newResult = result.substring(1, result.length() - 1).replaceAll("\\\\", "");
                        UtilsLog.e("getDataCarsList-newResult==" + newResult);
                        if (!TextUtils.isEmpty(newResult) && !"[[]]".equals(newResult) && !"[{}]".equals
                                (newResult) && !"[]".equals(newResult)) {
                            carsInforModelList = new ArrayList<CarsInforModel>();
                            carsInforModelList = JsonUtil.stringToArray(newResult, CarsInforModel[].class);
                            if (carsInforModelList != null && carsInforModelList.size() > 0) {
                                for (int i = 0; i < carsInforModelList.size(); i++) {
//                                    getDataCarItemsDetails(String.valueOf(carsInforModelList.get(i).getID()
//                                    ), i);
                                    //检测模式 0:外检  1：路试 2：底盘动态
                                    switch (CHECK_MODE) {
                                        case 0:
                                            if (carsInforModelList.get(i).getAppearanceStatus() == 0) {
                                                adapterCarsList.add(carsInforModelList.get(i));
                                            }
                                            break;
                                        case 1:
                                            if (carsInforModelList.get(i).getRoadStatus() == 0) {
                                                adapterCarsList.add(carsInforModelList.get(i));
                                            }
                                            break;
                                        case 2:
                                            if (carsInforModelList.get(i).getDynamicStatus() == 0) {
                                                adapterCarsList.add(carsInforModelList.get(i));
                                            }
                                            break;
                                    }
                                }

                                if (adapterCarsList != null && adapterCarsList.size() > 0) {
//                                    carsInforListAdapter.notifyDataSetChanged();
                                    carsInforListAdapter = new CarsInforListAdapter(DaiJianCars2Activity.this,
                                            adapterCarsList, CURRENT_CHECK_MODE);
                                    listShequgonggaoBaoxiu.setAdapter(carsInforListAdapter);
//                                    for (int i = 0; i < adapterCarsList.size(); i++) {
//                                        UtilsLog.e("getDataCarsList-carsInforModelList==" +
// adapterCarsList.get(i).toString());
//                                    }
                                } else {
                                    carsInforListAdapter = new CarsInforListAdapter(DaiJianCars2Activity.this,
                                            adapterCarsList, CURRENT_CHECK_MODE);
                                    listShequgonggaoBaoxiu.setAdapter(carsInforListAdapter);
//                                    carsInforListAdapter.notifyDataSetChanged();
                                }

                            } else {
                                UtilsLog.e("getDataCarsList-result==" + "2222没有数据");
                            }


                        } else {
                            UtilsLog.e("getDataCarsList-result==" + "没有数据");
                        }
                        CommonUtils.hideLoadingDialog(instances);
                    }

                    @Override
                    public void onError(Response<String> response) {
                        super.onError(response);
                        UtilsLog.e("getDataUsersList-onError==" + response.body());
                        CommonUtils.hideLoadingDialog(instances);
                    }
                });
    }


    //获取车辆列表根据选择的检测类型
    private void getDataCarsListByMode() {
        //检测模式 0:外检  F1 1：路试 R1 2：底盘动态 DC
        String car_url = "";
        switch (BaseApplication.JIANCE_MODE) {
            case 0:
                car_url = CARS_LIST_WAIJIAN;
                break;
            case 1:
                car_url = CARS_LIST_LUSHI;
                break;
            case 2:
                car_url = CARS_LIST_DIPAN_DONGTAI;
                break;
        }
        if (adapterCarsList != null) {
            adapterCarsList = new ArrayList<>();
        }
        String logStr = "\n" + "待检车辆列表------请求" + "\n" +
                "URL::" + SharedPreferencesUtils.getIP(instances) + car_url
                + "\n";
        PDALogUtils.createLogFile(BaseApplication.JIANCE_MODE, logStr.getBytes());
        UtilsLog.e("getDataCarsListByMode---url==" + SharedPreferencesUtils.getIP(this) + car_url);
        OkGo.<String>get(SharedPreferencesUtils.getIP(this) + car_url).tag(this)
                .execute(new StringCallback() {
                    @Override
                    public void onStart(Request<String, ? extends Request> request) {
                        super.onStart(request);
//                        CommonUtils.showLoadingDialog(instances, "加载中...");
                        WaitDialog.show(instances, "加载中...");
                    }

                    @Override
                    public void onSuccess(Response<String> response) {
                        String logStr = "\n" + "车辆队列--onSuccess" + "\n"
                                + "JSON::" + response.body();
                        PDALogUtils.createLogFile(0, logStr.getBytes());
                        String result = response.body();
//                        UtilsLog.e("getDataCarsList-result==" + result);
//                        String newResult = result.substring(1, result.length() - 1).replaceAll("\\\\", "");
                        String newResult = result;
                        UtilsLog.e("getDataCarsListByMode-newResult==" + newResult);
                        if (!TextUtils.isEmpty(newResult) && !"[[]]".equals(newResult) && !"[{}]".equals
                                (newResult) && !"[]".equals(newResult)) {
                            riZhao_carsInforModelList = new ArrayList<CarsInforModel_RiZhao>();
                            riZhao_carsInforModelList = JsonUtil.stringToArray(newResult, CarsInforModel_RiZhao[].class);
                            if (riZhao_carsInforModelList != null && riZhao_carsInforModelList.size() > 0) {
                                carsInforModelList = changeModelData(riZhao_carsInforModelList);

                                listShequgonggaoBaoxiu.setVisibility(View.VISIBLE);
                                carsInforListAdapter = new CarsInforListAdapter(DaiJianCars2Activity.this,
                                        carsInforModelList, CURRENT_CHECK_MODE);
                                listShequgonggaoBaoxiu.setAdapter(carsInforListAdapter);
                            } else {
                                listShequgonggaoBaoxiu.setVisibility(View.GONE);
//                                carsInforListAdapter.notifyDataSetChanged();
                                UtilsLog.e("getDataCarsListByMode-result==" + "2222没有数据");
                            }
                        } else {
                            listShequgonggaoBaoxiu.setVisibility(View.GONE);
//                            carsInforListAdapter.notifyDataSetChanged();
                            UtilsLog.e("getDataCarsListByMode-result==" + "没有数据");
                        }
//                        listShequgonggaoBaoxiu.setVisibility(View.VISIBLE);
//                        if (adapterCarsList != null && adapterCarsList.size() > 0) {
//                            carsInforListAdapter = new CarsInforListAdapter(DaiJianCars2Activity.this,
//                                    adapterCarsList, CURRENT_CHECK_MODE);
//                            listShequgonggaoBaoxiu.setAdapter(carsInforListAdapter);
//                            carsInforListAdapter.notifyDataSetChanged();
//                        } else {
//                            carsInforListAdapter = new CarsInforListAdapter(DaiJianCars2Activity.this,
//                                    adapterCarsList, CURRENT_CHECK_MODE);
//                            listShequgonggaoBaoxiu.setAdapter(carsInforListAdapter);
//                            carsInforListAdapter.notifyDataSetChanged();
//                        }
//                        CommonUtils.hideLoadingDialog(instances);
                        WaitDialog.dismiss();
//                        getDataCarsListByMode_2();
//                        CommonUtils.hideLoadingDialog(instances);
                    }

                    @Override
                    public void onError(Response<String> response) {
                        super.onError(response);
                        String logStr = "\n" + "车辆队列--onError" + "\n"
                                + "JSON::" + response.body();
                        PDALogUtils.createLogFile(0, logStr.getBytes());
                        UtilsLog.e("getDataCarsListByMode-onError==" + response.body());
//                        CommonUtils.hideLoadingDialog(instances);
                        WaitDialog.dismiss();
                    }
                });
    }

    //获取车辆列表根据选择的检测类型2
    private void getDataCarsListByMode_2() {
        //检测模式 0:外检  F1 1：路试 R1 2：底盘动态 DC
        String car_url = "";
        switch (BaseApplication.JIANCE_MODE) {
            case 0:
                car_url = CAR_LIST_WAIJIAN_2;
                break;
            case 1:
                car_url = CAR_LIST_LUSHI_2;
                break;
            case 2:
                car_url = CAR_LIST_DIPAN_2;
                break;
        }
//        if(adapterCarsList!=null){
//            adapterCarsList.clear();
//        }
        UtilsLog.e("getDataCarsListByMode-22--url==" + SharedPreferencesUtils.getIP(this) + car_url);
        OkGo.<String>get(SharedPreferencesUtils.getIP(this) + car_url).tag(this)
                .execute(new StringCallback() {
                    @Override
                    public void onStart(Request<String, ? extends Request> request) {
                        super.onStart(request);
//                        CommonUtils.showLoadingDialog(instances, "加载中...");
                    }

                    @Override
                    public void onSuccess(Response<String> response) {
                        String result = response.body();
//                        UtilsLog.e("getDataCarsList-result==" + result);
                        String newResult = result.substring(1, result.length() - 1).replaceAll("\\\\", "");
                        UtilsLog.e("getDataCarsListByMode-newResult=22=" + newResult);
                        if (!TextUtils.isEmpty(newResult) && !"[[]]".equals(newResult) && !"[{}]".equals
                                (newResult) && !"[]".equals(newResult)) {
                            carsInforModelList_2 = new ArrayList<CarsInforModel>();
                            carsInforModelList_2 = JsonUtil.stringToArray(newResult, CarsInforModel[].class);
                            if (carsInforModelList_2 != null && carsInforModelList_2.size() > 0) {
                                for (int i = 0; i < carsInforModelList_2.size(); i++) {
                                    adapterCarsList.add(carsInforModelList_2.get(i));
                                }
                            } else {
                                listShequgonggaoBaoxiu.setVisibility(View.GONE);
//                                carsInforListAdapter.notifyDataSetChanged();
                                UtilsLog.e("getDataCarsListByMode-result=22=" + "2222没有数据");
                            }
                        } else {
                            listShequgonggaoBaoxiu.setVisibility(View.GONE);
//                            carsInforListAdapter.notifyDataSetChanged();
                            UtilsLog.e("getDataCarsListByMode-result=22=" + "没有数据");
                        }
                        listShequgonggaoBaoxiu.setVisibility(View.VISIBLE);
                        if (adapterCarsList != null && adapterCarsList.size() > 0) {
                            carsInforListAdapter = new CarsInforListAdapter(DaiJianCars2Activity.this,
                                    adapterCarsList, CURRENT_CHECK_MODE);
                            listShequgonggaoBaoxiu.setAdapter(carsInforListAdapter);
                        } else {
                            carsInforListAdapter = new CarsInforListAdapter(DaiJianCars2Activity.this,
                                    adapterCarsList, CURRENT_CHECK_MODE);
                            listShequgonggaoBaoxiu.setAdapter(carsInforListAdapter);
//                                    carsInforListAdapter.notifyDataSetChanged();
                        }
                        CommonUtils.hideLoadingDialog(instances);
                    }

                    @Override
                    public void onError(Response<String> response) {
                        super.onError(response);
                        UtilsLog.e("getDataCarsListByMode-onError=22=" + response.body());
                        CommonUtils.hideLoadingDialog(instances);
                    }
                });
    }

    //查询
    //carNO 车牌号码
    private void getDataSearchCars(String carNO) {
        UtilsLog.e("getDataCarsList---url==" + SharedPreferencesUtils.getIP(this) + CARS_LIST_FRONT +
                CARS_LIST_STATUS + CARS_LIST_BEHIND);
        OkGo.<String>get(SharedPreferencesUtils.getIP(this) + CARS_LIST_FRONT + CARS_LIST_STATUS +
                CARS_LIST_BEHIND).tag(this)
                .execute(new StringCallback() {
                    @Override
                    public void onStart(Request<String, ? extends Request> request) {
                        super.onStart(request);
                        CommonUtils.showLoadingDialog(instances, "加载中...");
                    }

                    @Override
                    public void onSuccess(Response<String> response) {
                        String result = response.body();
                        UtilsLog.e("getDataCarsList-result==" + result);
                        String newResult = result.substring(1, result.length() - 1).replaceAll("\\\\", "");
                        UtilsLog.e("getDataCarsList-newResult==" + newResult);
                        if (!TextUtils.isEmpty(newResult) && !"[[]]".equals(newResult) && !"[{}]".equals
                                (newResult) && !"[]".equals(newResult)) {
                            carsInforModelList = JsonUtil.stringToArray(newResult, CarsInforModel[].class);
                            carsInforListAdapter = new CarsInforListAdapter(DaiJianCars2Activity.this,
                                    carsInforModelList, CURRENT_CHECK_MODE);
                            listShequgonggaoBaoxiu.setAdapter(carsInforListAdapter);
                        } else {
                            UtilsLog.e("getDataCarsList-result==" + "没有数据");
                        }
                        CommonUtils.hideLoadingDialog(instances);
                    }

                    @Override
                    public void onError(Response<String> response) {
                        super.onError(response);
                        UtilsLog.e("getDataUsersList-onError==" + response.body());
                        CommonUtils.hideLoadingDialog(instances);
                    }
                });
    }

    //废弃--不用
    //获取对应车辆要检测的项目
    private void getDataCarItemsDetails(String DetectionID, final int i_position) {
        UtilsLog.e("getDataCarItemsDetails---url==" + SharedPreferencesUtils.getIP(instances) +
                CAR_ITEM_CHECK + DetectionID + "/DetectionID");
        OkGo.<String>get(SharedPreferencesUtils.getIP(instances) + CAR_ITEM_CHECK + DetectionID +
                "/DetectionID").tag(instances)

                .execute(new StringCallback() {
                    @Override
                    public void onStart(Request<String, ? extends Request> request) {
                        super.onStart(request);
//                        CommonUtils.showLoadingDialog(instances, "加载中...");
                    }

                    @Override
                    public void onSuccess(Response<String> response) {
                        String result = response.body();

                        String newResult = result.substring(1, result.length() - 1).replaceAll("\\\\", "");
                        UtilsLog.e("getDataCarItemsDetails-result==" + newResult);


                        UtilsLog.e("getDataCarItemsDetails-CURRENT_CHECK_MODE==" + CURRENT_CHECK_MODE);
                        if (!TextUtils.isEmpty(newResult) && !"[[]]".equals(newResult) && !"[{}]".equals
                                (newResult) && !"[]".equals(newResult)) {
                            carCheckItemModelList = JsonUtil.stringToArray(newResult, CarCheckItemsModel[]
                                    .class);
                            if (carCheckItemModelList != null && carCheckItemModelList.size() > 0) {
                                for (int i = 0; i < carsInforModelList.size(); i++) {
                                    String itemCode = carsInforModelList.get(i).getItemCode();
                                    String itemStatus = carsInforModelList.get(i).getItemStatus();
                                    if (!TextUtils.isEmpty(itemCode) && !TextUtils.isEmpty(itemStatus)) {
                                        if (itemStatus.equals("0") && CURRENT_CHECK_MODE.equals(itemCode)) {
                                            UtilsLog.e("getDataCarItemsDetails-model=11=" +
                                                    carsInforModelList.get(i).toString());

                                        }
                                    }

                                }
                                for (int i = 0; i < carCheckItemModelList.size(); i++) {
                                    String itemCode = carCheckItemModelList.get(i).getItemCode();
                                    int itemStatus = carCheckItemModelList.get(i).getItemStatus();
                                    if (itemStatus == 0 && CURRENT_CHECK_MODE.equals(itemCode)) {
                                        CarsInforModel c = carsInforModelList.get(i_position);
                                        c.setItemCode(itemCode);
                                        c.setItemStatus(String.valueOf(itemStatus));
                                        carsInforModelList.set(i_position, c);
//
//                                       carsInforModelList.remove(i_position);
//                                       carsInforModelList.add(c);
                                    }
                                }
                                for (int i = 0; i < carsInforModelList.size(); i++) {
                                    String itemCode = carsInforModelList.get(i).getItemCode();
                                    String itemStatus = carsInforModelList.get(i).getItemStatus();
                                    if (!TextUtils.isEmpty(itemCode) && !TextUtils.isEmpty(itemStatus)) {
                                        if (itemStatus.equals("0") && CURRENT_CHECK_MODE.equals(itemCode)) {
                                            UtilsLog.e("getDataCarItemsDetails-model=22=" +
                                                    carsInforModelList.get(i).toString());

                                        }
                                    }

                                }
                                carsInforListAdapter = new CarsInforListAdapter(DaiJianCars2Activity.this,
                                        carsInforModelList, CURRENT_CHECK_MODE);
                                listShequgonggaoBaoxiu.setAdapter(carsInforListAdapter);
                            }
                        } else {
                            UtilsLog.e("getDataCarsList-result==" + "没有数据");
                        }

                        CommonUtils.hideLoadingDialog(instances);
                    }

                    @Override
                    public void onError(Response<String> response) {
                        super.onError(response);
                        UtilsLog.e("getDataCarItemsDetails-onError==" + response.body());
                        UtilsLog.e("getDataCarItemsDetails-onError==" + response.getException());
                        CommonUtils.hideLoadingDialog(instances);
                        Toast.makeText(instances, getResources().getString(R.string.services_error), Toast
                                .LENGTH_LONG).show();
                    }
                });
    }

    //不自动刷新的查询
    //carNO 车牌号码
    private void getDataSearchCarsByNO(DownLineModel downLineModel) {
        Gson gson = new Gson();
        String json_str = gson.toJson(downLineModel);
        UtilsLog.e("getDataSearchCarsByNO---json_str==" + json_str);
        UtilsLog.e("getDataSearchCarsByNO---url==" + SharedPreferencesUtils.getIP(this) + RECHECK_CARS_LIST);
        String logStr = "\n" + "待检车辆列表--查询----请求" + "\n" +
                "URL::" + SharedPreferencesUtils.getIP(instances) + RECHECK_CARS_LIST
                + "\n" + "json" + json_str;
        PDALogUtils.createLogFile(BaseApplication.JIANCE_MODE, logStr.getBytes());

        OkGo.<String>post(SharedPreferencesUtils.getIP(this) + RECHECK_CARS_LIST).tag(this)
                .upJson(json_str)
                .execute(new StringCallback() {
                    @Override
                    public void onStart(Request<String, ? extends Request> request) {
                        super.onStart(request);
                    }

                    @Override
                    public void onSuccess(Response<String> response) {
                        String result = response.body();
//                        String newResult = result.substring(1, result.length() - 1).replaceAll("\\\\", "");
                        String newResult = result;
                        UtilsLog.e("getDataSearchCarsByNO-newResult==" + newResult);

                        String logStr = "\n" + "按车牌号查询车辆列表--查询----请求成功" + "\n" +
                                "result::" + response.body() + "\n" +
                                "URL::" + SharedPreferencesUtils.getIP(instances) + RECHECK_CARS_LIST;
                        PDALogUtils.createLogFile(BaseApplication.JIANCE_MODE, logStr.getBytes());

                        if (!TextUtils.isEmpty(newResult) && !"[[]]".equals(newResult) && !"[{}]".equals
                                (newResult) && !"[]".equals(newResult)) {
                            riZhao_carsInforModelList = new ArrayList<CarsInforModel_RiZhao>();
                            searChCarsList_one = new ArrayList<CarsInforModel>();
                            searChCarsFilterList = new ArrayList<CarsInforModel>();
                            riZhao_carsInforModelList = JsonUtil.stringToArray(newResult, CarsInforModel_RiZhao[]
                                    .class);
                            if (riZhao_carsInforModelList != null && riZhao_carsInforModelList.size() > 0) {
                                searChCarsList_one = changeModelData(riZhao_carsInforModelList);
                                PDALogUtils.createLogFile(BaseApplication.JIANCE_MODE, ("searChCarsList_one==" + searChCarsList_one).getBytes());
                                for (int i = 0; i < searChCarsList_one.size(); i++) {
                                    if (isButton) {
                                        searChCarsFilterList.add(searChCarsList_one.get(i));
                                        isButton = false;
                                    } else {
                                        switch (BaseApplication.JIANCE_MODE) {
                                            case 0:
                                                if (searChCarsList_one.get(i).getAppearanceStatus() == 0 ||
                                                        searChCarsList_one.get(i).getAppearanceStatus() ==
                                                                ITEM_MIDDLE_EXIT_CODE) {
                                                    searChCarsFilterList.add(searChCarsList_one.get(i));
                                                }
                                                break;
                                            case 1:
                                                if (searChCarsList_one.get(i).getRoadStatus() == 0 ||
                                                        searChCarsList_one.get(i).getRoadStatus() ==
                                                                ITEM_MIDDLE_EXIT_CODE) {
                                                    searChCarsFilterList.add(searChCarsList_one.get(i));
                                                }
                                                break;
                                            case 2:
                                                if (searChCarsList_one.get(i).getDynamicStatus() == 0 ||
                                                        searChCarsList_one.get(i).getDynamicStatus() ==
                                                                ITEM_MIDDLE_EXIT_CODE) {
                                                    searChCarsFilterList.add(searChCarsList_one.get(i));
                                                }
                                                break;
                                        }
                                    }
                                }
                                if (searChCarsFilterList != null && searChCarsFilterList.size() > 0) {
                                    carsInforListAdapter = new CarsInforListAdapter(DaiJianCars2Activity.this,
                                            searChCarsFilterList, CURRENT_CHECK_MODE);
                                    listShequgonggaoBaoxiu.setAdapter(carsInforListAdapter);
                                    listShequgonggaoBaoxiu.setVisibility(View.VISIBLE);
                                } else {
                                    if (searChCarsFilterList != null) {
                                        searChCarsFilterList.clear();
                                    }
                                    listShequgonggaoBaoxiu.setVisibility(View.GONE);
                                }
                            } else {
                                listShequgonggaoBaoxiu.setVisibility(View.GONE);
//                                Toast.makeText(instances, "没有查询到相关车辆", Toast
//                                        .LENGTH_LONG).show();
                            }

                        } else {
                            listShequgonggaoBaoxiu.setVisibility(View.GONE);
                            UtilsLog.e("getDataSearchCarsByNO-result==" + "没有数据");
//                            Toast.makeText(instances, "没有查询到相关车辆", Toast
//                                    .LENGTH_LONG).show();
                        }
                        CommonUtils.hideLoadingDialog(instances);
                    }

                    @Override
                    public void onError(Response<String> response) {
                        super.onError(response);
                        UtilsLog.e("getDataSearchCarsByNO-onError==" + response.body());
                        String logStr = "\n" + "待检车辆列表--查询----请求失败--error" + "\n" +
                                "result::" + response.body() + "\n" +
                                "URL::" + SharedPreferencesUtils.getIP(instances) + RECHECK_CARS_LIST;
                        PDALogUtils.createLogFile(BaseApplication.JIANCE_MODE, logStr.getBytes());
                        CommonUtils.hideLoadingDialog(instances);
                    }
                });
    }

    private List<CarsInforModel> changeModelData(List<CarsInforModel_RiZhao> riZhaoList) {
        List<CarsInforModel> carList = new ArrayList<>();
        CarsInforModel model = null;
        for (int i = 0; i < riZhaoList.size(); i++) {
            model = new CarsInforModel();
            model.setVehicleInfoID(riZhaoList.get(i).getVehicleInfo().getVehicleInfoID() != null ? riZhaoList.get(i).getVehicleInfo().getVehicleInfoID() : "");
            model.setPlateNO(riZhaoList.get(i).getVehicleInfo().getPlateNO() != null ? riZhaoList.get(i).getVehicleInfo().getPlateNO() : "");
            model.setPlateType(riZhaoList.get(i).getVehicleInfo().getPlateType() != null ? riZhaoList.get(i).getVehicleInfo().getPlateType() : "");
            model.setPlateColor(riZhaoList.get(i).getVehicleInfo().getPlateColor() != null ? riZhaoList.get(i).getVehicleInfo().getPlateColor() : "");
            model.setVIN(riZhaoList.get(i).getVehicleInfo().getVIN() != null ? riZhaoList.get(i).getVehicleInfo().getVIN() : "");
            model.setOwner(riZhaoList.get(i).getVehicleInfo().getOwner() != null ? riZhaoList.get(i).getVehicleInfo().getOwner() : "");
            model.setAddress(riZhaoList.get(i).getVehicleInfo().getAddress() != null ? riZhaoList.get(i).getVehicleInfo().getAddress() : "");
            model.setTelephone(riZhaoList.get(i).getVehicleInfo().getTelephone() != null ? riZhaoList.get(i).getVehicleInfo().getTelephone() : "");
            model.setArea(riZhaoList.get(i).getVehicleInfo().getArea() != null ? riZhaoList.get(i).getVehicleInfo().getArea() : "");
            model.setVehicleType(riZhaoList.get(i).getVehicleInfo().getVehicleType() != null ? riZhaoList.get(i).getVehicleInfo().getVehicleType() : "");
            model.setBrand(riZhaoList.get(i).getVehicleInfo().getBrand() != null ? riZhaoList.get(i).getVehicleInfo().getBrand() : "");
            model.setCarModel(riZhaoList.get(i).getVehicleInfo().getCarModel() != null ? riZhaoList.get(i).getVehicleInfo().getCarModel() : "");
            model.setEngineNO(riZhaoList.get(i).getVehicleInfo().getEngineNO() != null ? riZhaoList.get(i).getVehicleInfo().getEngineNO() : "");
            model.setEngineModel(riZhaoList.get(i).getVehicleInfo().getEngineModel() != null ? riZhaoList.get(i).getVehicleInfo().getEngineModel() : "");
            model.setProductionDate(riZhaoList.get(i).getVehicleInfo().getProductionDate() != null ? riZhaoList.get(i).getVehicleInfo().getProductionDate() : "");
            model.setRegisteDate(riZhaoList.get(i).getVehicleInfo().getRegisteDate() != null ? riZhaoList.get(i).getVehicleInfo().getRegisteDate() : "");
            model.setTotalMass(riZhaoList.get(i).getVehicleInfo().getTotalMass() != null ? riZhaoList.get(i).getVehicleInfo().getTotalMass() : "");
            model.setCurbWeight(riZhaoList.get(i).getVehicleInfo().getCurbWeight() != null ? riZhaoList.get(i).getVehicleInfo().getCurbWeight() : "");
            model.setApprovedLoad(riZhaoList.get(i).getVehicleInfo().getApprovedLoad() != null ? riZhaoList.get(i).getVehicleInfo().getApprovedLoad() : "");
            model.setUseProperty(riZhaoList.get(i).getVehicleInfo().getUseProperty() != null ? riZhaoList.get(i).getVehicleInfo().getUseProperty() : "");
            model.setCategory(riZhaoList.get(i).getVehicleInfo().getCategory() != null ? riZhaoList.get(i).getVehicleInfo().getCategory() : "");
            model.setUsage(riZhaoList.get(i).getVehicleInfo().getUsage() != null ? riZhaoList.get(i).getVehicleInfo().getUsage() : "");
            model.setUseAttribute(riZhaoList.get(i).getVehicleInfo().getUseAttribute() != null ? riZhaoList.get(i).getVehicleInfo().getUseAttribute() : "");
            model.setExpirationDate(riZhaoList.get(i).getVehicleInfo().getExpirationDate() != null ? riZhaoList.get(i).getVehicleInfo().getExpirationDate() : "");
            model.setLatestDate(riZhaoList.get(i).getVehicleInfo().getLatestDate() != null ? riZhaoList.get(i).getVehicleInfo().getLatestDate() : "");
            model.setScrapDate(riZhaoList.get(i).getVehicleInfo().getScrapDate() != null ? riZhaoList.get(i).getVehicleInfo().getScrapDate() : "");
            model.setValidTill(riZhaoList.get(i).getVehicleInfo().getValidTill() != null ? riZhaoList.get(i).getVehicleInfo().getValidTill() : "");
            model.setFuelType(riZhaoList.get(i).getVehicleInfo().getFuelType() != null ? riZhaoList.get(i).getVehicleInfo().getFuelType() : "");
            model.setFuelModel(riZhaoList.get(i).getVehicleInfo().getFuelModel() != null ? riZhaoList.get(i).getVehicleInfo().getFuelModel() : "");
            model.setDisplacement(riZhaoList.get(i).getVehicleInfo().getDisplacement() != null ? riZhaoList.get(i).getVehicleInfo().getDisplacement() : "");
            model.setPower(riZhaoList.get(i).getVehicleInfo().getPower() != null ? riZhaoList.get(i).getVehicleInfo().getPower() : "");
            model.setParkingAxle(riZhaoList.get(i).getVehicleInfo().getParkingAxle() != null ? riZhaoList.get(i).getVehicleInfo().getParkingAxle() : "");
            model.setWheelBase(riZhaoList.get(i).getVehicleInfo().getWheelBase() != null ? riZhaoList.get(i).getVehicleInfo().getWheelBase() : "");
            model.setFrontTrack(riZhaoList.get(i).getVehicleInfo().getFrontTrack() != null ? riZhaoList.get(i).getVehicleInfo().getFrontTrack() : "");
            model.setRearTrack(riZhaoList.get(i).getVehicleInfo().getRearTrack() != null ? riZhaoList.get(i).getVehicleInfo().getRearTrack() : "");
            model.setOutlineLength(riZhaoList.get(i).getVehicleInfo().getOutlineLength() != null ? riZhaoList.get(i).getVehicleInfo().getOutlineLength() : "");
            model.setOutlineWidth(riZhaoList.get(i).getVehicleInfo().getOutlineWidth() != null ? riZhaoList.get(i).getVehicleInfo().getOutlineWidth() : "");
            model.setOutlineHeight(riZhaoList.get(i).getVehicleInfo().getOutlineHeight() != null ? riZhaoList.get(i).getVehicleInfo().getOutlineHeight() : "");
            model.setStatus(riZhaoList.get(i).getVehicleInfo().getStatus() != null ? riZhaoList.get(i).getVehicleInfo().getStatus() : "");
            model.setDriveAxle(riZhaoList.get(i).getVehicleInfo().getDriveAxle() != null ? riZhaoList.get(i).getVehicleInfo().getDriveAxle() : "");
            model.setBrakeForce(riZhaoList.get(i).getVehicleInfo().getBrakeForce() != null ? riZhaoList.get(i).getVehicleInfo().getBrakeForce() : "");
            model.setHeadlightSystem(riZhaoList.get(i).getVehicleInfo().getHeadlightSystem() != null ? riZhaoList.get(i).getVehicleInfo().getHeadlightSystem() : "");
            model.setHighbeamAdjust(riZhaoList.get(i).getVehicleInfo().getHighbeamAdjust() != null ? riZhaoList.get(i).getVehicleInfo().getHighbeamAdjust() : "");
            model.setSuspensionForm(riZhaoList.get(i).getVehicleInfo().getSuspensionForm() != null ? riZhaoList.get(i).getVehicleInfo().getSuspensionForm() : "");
            model.setOdometer(riZhaoList.get(i).getVehicleInfo().getOdometer() != null ? riZhaoList.get(i).getVehicleInfo().getOdometer() : "");
            model.setMainAxis(riZhaoList.get(i).getVehicleInfo().getMainAxis() != null ? riZhaoList.get(i).getVehicleInfo().getMainAxis() : "");
            model.setTotalAxis(riZhaoList.get(i).getVehicleInfo().getTotalAxis() != null ? riZhaoList.get(i).getVehicleInfo().getTotalAxis() : "");
            model.setParkingAxis(riZhaoList.get(i).getVehicleInfo().getParkingAxis() != null ? riZhaoList.get(i).getVehicleInfo().getParkingAxis() : "");
            model.setBodyColor(riZhaoList.get(i).getVehicleInfo().getBodyColor() != null ? riZhaoList.get(i).getVehicleInfo().getBodyColor() : "");
            model.setUnderpanType(riZhaoList.get(i).getVehicleInfo().getUnderpanType() != null ? riZhaoList.get(i).getVehicleInfo().getUnderpanType() : "");
            model.setDriverType(riZhaoList.get(i).getVehicleInfo().getDriverType() != null ? riZhaoList.get(i).getVehicleInfo().getDriverType() : "");
            model.setCentralAxle(riZhaoList.get(i).getVehicleInfo().getCentralAxle() != null ? riZhaoList.get(i).getVehicleInfo().getCentralAxle() : "");
            model.setMotoRate(riZhaoList.get(i).getVehicleInfo().getMotoRate() != null ? riZhaoList.get(i).getVehicleInfo().getMotoRate() : "");
            model.setDriverAxleWeight(riZhaoList.get(i).getVehicleInfo().getDriverAxleWeight() != null ? riZhaoList.get(i).getVehicleInfo().getDriverAxleWeight() : "");
            model.setTransmissionType(riZhaoList.get(i).getVehicleInfo().getTransmissionType() != null ? riZhaoList.get(i).getVehicleInfo().getTransmissionType() : "");
            model.setAirAdmission(riZhaoList.get(i).getVehicleInfo().getAirAdmission() != null ? riZhaoList.get(i).getVehicleInfo().getAirAdmission() : "");
            model.setFuelSupply(riZhaoList.get(i).getVehicleInfo().getFuelSupply() != null ? riZhaoList.get(i).getVehicleInfo().getFuelSupply() : "");
            model.setTurnAxis(riZhaoList.get(i).getVehicleInfo().getTurnAxis() != null ? riZhaoList.get(i).getVehicleInfo().getTurnAxis() : "");

            model.setDetectQueueID(riZhaoList.get(i).getDetectQueueID());
            model.setSN(riZhaoList.get(i).getSN());
            model.setTimes(riZhaoList.get(i).getTimes());
            model.setDetectStatus(riZhaoList.get(i).getDetectStatus());
            model.setDetectDate(riZhaoList.get(i).getDetectDate());
            model.setDetectCategory(riZhaoList.get(i).getDetectCategory());
            model.setLine(riZhaoList.get(i).getLine() != null ? riZhaoList.get(i).getLine() : "1");
            model.setLeadTruck(riZhaoList.get(i).getLeadTruck() != null ? riZhaoList.get(i).getLeadTruck() : "");
            model.setOperator(riZhaoList.get(i).getOperator());
            model.setAppearanceInspector(riZhaoList.get(i).getAppearanceInspector() != null ? riZhaoList.get(i).getAppearanceInspector() : "");
            model.setDynamicInspector(riZhaoList.get(i).getDynamicInspector() != null ? riZhaoList.get(i).getDynamicInspector() : "");
            model.setStaticInspector(riZhaoList.get(i).getStaticInspector() != null ? riZhaoList.get(i).getStaticInspector() : "");
            model.setPrintStatus(riZhaoList.get(i).getPrintStatus());
            model.setUploadStatus(riZhaoList.get(i).getUploadStatus());
            model.setVehicleID(Integer.valueOf(riZhaoList.get(i).getVehicleID()));
            carList.add(model);
        }

        String logStr = "\n" + "车辆列表--数据:" +
                "\n" + "carList::" + carList.toString();
        PDALogUtils.createLogFile(0, logStr.getBytes());
        return carList;
    }

}